<template>
	<view class="huafenjiance">
		<headertop title="花粉检测" str="orderlist" str1="oridei" :back1="back1"></headertop>
		<image :src="_static('/images/Mask group@2x(4).png')" class="huafenjianceback" mode=""></image>
		<view class="" :style="{'margin-top':statusBarHeight+'px','width':'100%','height':barHeight+'px'}">
		</view>
		<view class="bottombox">
			<view class="msgicon" v-if="!list.length">
				<image :src="_static('/images/wxnone.png')" mode="widthFix">
				</image>
				<view class="msgtext">
					暂无内容
				</view>
			</view>
			<view class="itembox" v-for="item in list" :key="item.id" @click="gopage(item)">
				<view class="centertext">
					<view class="t1">
						{{item['title']}}
					</view>
					<view class="date">
						{{item['createtime']}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import headertop from '@/components/header.vue'
	import {
		_static
	} from '@/ulm/utils/url.js'
	import {
		onPageScroll,
		onLoad,
		onShow,
		onReachBottom
	} from "@dcloudio/uni-app";
	import {
		ref,
		reactive,
		onMounted
	} from 'vue'
	const statusBarHeight = ref('')
	const total = ref(0)
	const list = ref([])
	const formData = reactive({
		page: 1,
		list_rows: 10
	})
	import ulm, {
		$api
	} from '@/ulm';
	const barHeight = ref('')
	const back1 = ref('')
	onMounted(() => {
		statusBarHeight.value = uni.getSystemInfoSync().statusBarHeight
		const {
			top,
			height
		} = wx.getMenuButtonBoundingClientRect();
		barHeight.value = height ? height + (top - statusBarHeight.value) * 2 : 38;
	})
	onLoad(() => {
		init()
	})
	onReachBottom(() => {
		if (total.value > list.value.length) {
			formData['page']++
			init()
		}
	})
	onPageScroll((e) => {
		if (e.scrollTop > 100) {
			back1.value = '#81D6FF'
		} else {
			back1.value = ''
		}
	})

	function gopage(item) {
		uni.navigateTo({
			url: '/sub_index/index/huafendetail?id=' + item.id
		})
	}
	async function init() {
		const res = await $api.pollenList(formData)
		if (res.code == 1) {
			list.value.push(...res.data.data)
			total.valur = res.data.total
		}
	}
</script>

<style lang="scss">
	.msgicon {
		width: 608rpx;
		margin: 100rpx auto;
		overflow: hidden;

		.msgtext {
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			font-size: 28rpx;
			color: #86909C;
			text-align: center;
			width: 100%;
			margin-top: 30rpx;
		}

		image {
			width: 608rpx;
		}
	}

	page {
		background: #F7F8FA;
	}

	.huafenjiance {
		width: 100%;
		overflow: hidden;
		position: relative;

		.huafenjianceback {
			width: 100%;
			height: 450rpx;
			position: absolute;
			z-index: -1;
		}

		.bottombox {
			width: 100%;
			background: #F7F8FA;
			box-shadow: 0rpx -4rpx 14rpx 0rpx rgba(143, 217, 254, 0.68);
			border-radius: 48rpx 48rpx 0rpx 0rpx;
			margin-top: 224rpx;
			overflow: hidden;
			padding: 32rpx 0;

			.itembox {
				width: 686rpx;
				height: 148rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0, 0, 0, 0.05);
				border-radius: 16rpx 16rpx 16rpx 16rpx;
				overflow: hidden;
				margin: auto;
				margin-bottom: 28rpx;

				.centertext {
					width: 632rpx;
					margin: auto;
					margin-top: 32rpx;
					overflow: hidden;

					.t1 {
						font-family: PingFang SC, PingFang SC;
						font-weight: 500;
						font-size: 30rpx;
						color: #1D2129;
					}

					.texts {
						width: 100%;
						font-family: PingFang SC, PingFang SC;
						font-weight: 400;
						font-size: 28rpx;
						color: #4E5969;
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-line-clamp: 2;
						-webkit-box-orient: vertical;
						margin-top: 28rpx;
					}

					.date {
						font-family: PingFang SC, PingFang SC;
						font-weight: 400;
						font-size: 28rpx;
						color: #4E5969;
						margin-top: 24rpx;
					}
				}
			}
		}
	}
</style>